home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / due-crk.txt < prev    next >
Encoding:
Text File  |  2000-07-16  |  14.3 KB  |  358 lines

  1.                       Tutorial for Duelist's Crackme #3
  2.                               cracked by Nuno1
  3.                         any comments are welcome to :
  4.                              Nuno_2@hotmail.com
  5.  
  6.  
  7. hey crackerz !
  8. Duelist's Crackme #3 is a nice intersting crackme , i enjoyed crack it
  9. (as mostly i enjoy cracking anything :) )
  10.  
  11. DueList's Crackme puzzle is a nice 18 checkboxs that we need to find out
  12. witch one need to be ON and witch one need to be OFF . you can try to guess
  13. them , trust me , you dont really want to start 18^18 trys ;)
  14.  
  15. as the readme file said . you can use a resource editor (or even you should
  16. use one) , but in this crack i even didn't have to use it .. even that it
  17. could help me a bit ;)
  18.  
  19. let start working !
  20.  
  21. 1.first we want to see what the crackme offer us . so let start with a nice
  22.   breakpoint .. i prefer using SoftIce but u can use what ever debugger you
  23.   like.
  24.  
  25.   so we can break on a message for a Button click , but we can even get
  26.   closer if we will break in the API call for checking the CheckBox.
  27.  
  28.   so if you dont know the function that do it , you are welcome to run
  29.   a dissassembly and try to search for a good looking function that do it
  30.   even that i am going to tell you ;) .
  31.  
  32.   the function called "isDlgButtonChecked" . this function called when trying
  33.   to get infromation from a checkbox. it return on EAX 0 if FALSE , 1 if TRUE
  34.  
  35.   so let start rolling.
  36.  
  37.   do a "bpx isDlgButtonChecked" and press couple of F12 till you get to here :
  38.  
  39. :00401117 33F6                    xor esi, esi
  40. :00401119 33D2                    xor edx, edx
  41. :0040111B 89355E214000            mov dword ptr [0040215E], esi
  42. :00401121 893562214000            mov dword ptr [00402162], esi
  43. :00401127 0FBE8EFE204000          movsx ecx, byte ptr [esi+004020FE]
  44. :0040112E 83F94D                  cmp ecx, 0000004D
  45. :00401131 742F                    je 00401162
  46. :00401133 890D5E214000            mov dword ptr [0040215E], ecx
  47. :00401139 51                      push ecx
  48. :0040113A FF7508                  push [ebp+08]
  49. :0040113D E8D0010000              Call 00401312 --> this is the call to
  50.                                                     isDlgButtonChecked
  51.                                                     -- you will be here --.
  52. :00401142 46                      inc esi
  53. :00401143 83F800                  cmp eax, 00000000
  54. :00401146 74DF                    je 00401127
  55. :00401148 A15E214000              mov eax, dword ptr [0040215E]
  56. :0040114D 0FBE8EFE204000          movsx ecx, byte ptr [esi+004020FE]
  57. :00401154 0FAFC1                  imul eax, ecx
  58. :00401157 0FAFC6                  imul eax, esi
  59.  
  60.  
  61.   so we just break into .. let see now what this have to say to us :
  62.  
  63.  
  64. xor esi, esi                       ;esi will be 0 here
  65. xor edx, edx                       ;edx will be 0 here.
  66. mov dword ptr [0040215E], esi      ;those vars will be 0 too . (esi=0)
  67. mov dword ptr [00402162], esi
  68.  
  69. :00401127:  -- Jmp here --
  70. movsx ecx, byte ptr [esi+004020FE] ;mmmm , look intersting till now
  71.                                    ;moving to ecx somthing from esi+004020fe
  72.                                    ;as it look like. it is a table .
  73.                                    ;first esi=0 so it takes the 004020fe value
  74.  
  75. cmp ecx, 0000004D                  ;checking if ecx=4Dh ??? whats that ?
  76. je 00401162                        ;if ecx is 4Dh we jmp to somewhere
  77.  
  78. mov dword ptr [0040215E], ecx      ;moving what we got to the var that we
  79.                                    ;init in start.
  80.  
  81. push ecx                           ;pushing this value ?!?! what is it ?
  82. push [ebp+08]                    
  83. Call 00401312                      ;now this is the call to isDlgbuttonChecked!
  84.                                    ;as we can guess the table above is the
  85.                                    ;IDs for the checkboxs ..
  86.                                    ;good ! now we got somthing new !
  87.                                                 
  88.                                                 
  89. inc esi                            ;increase the esi (now will be 1)
  90. cmp eax, 00000000                  ;as i told before isDlgButtionChecked
  91.                                    ;return 0 if it is not checked.
  92.  
  93. je 00401127                        ;jmp if not checked
  94.  
  95.                                    ;here he will continue if checked.
  96. mov eax, dword ptr [0040215E]      ;moving this strange number to EAX
  97.  
  98. movsx ecx, byte ptr [esi+004020FE] ;hey .. now we get the next number of
  99.                                    ;the table (remember esi = 1 now)
  100.                                    ;so does it the second checkbox ?
  101.                                    ;we will try to find out.
  102.  
  103.                                         
  104. imul eax, ecx                      ;he mul the first ID with the second ID ??
  105.                                    ;its look like the ID's are more then an
  106.                                    ;handle here !
  107.                                    ;so eax=first ID * second ID at the first
  108.                                    ;time.
  109.  
  110. imul eax, esi                      ;now he mul the result with esi ?
  111.                                    ;is esi is a counter of somthing ?     
  112.                                                                            
  113. add dword ptr [00402162], eax      ;oh ! now he use the second var !
  114.                                    ;now he add the result of all this to it.
  115. jmp 00401127                       ;jmp back up!
  116.                                    ;so we can see this is a loop!
  117.  
  118. //all here is after the loop end .. let see what now.
  119.  
  120.  
  121. mov eax, dword ptr [00402162]      ;he take the result of the shit we done.
  122. imul eax, 0000004D                 ;mul it with 004dh
  123.  
  124. cmp eax, 00F35466                 
  125.                                 
  126. jne 00401191                       ;then if it is not equal to 00f35466
  127.                                    ;he jump ! maybe this is the result
  128.                                    ;it need to be ?
  129.                                    ;so i guess we now on the "good guy code"
  130. push 00002000
  131. push 00402001
  132. push 00402017
  133. push 00000000
  134. Call 004012DC
  135. mov eax, 00000001
  136. jmp 004010FA
  137.  
  138. ----- Bad guy code ???? -----
  139. :00401191
  140.  
  141. push 00002000
  142. push 00402001
  143. push 00402068
  144.  
  145.  
  146.   ok . we done well .. now let see the things we have in mind :
  147.  
  148.     - the ID's of the checkboxs are used for calculation the code.
  149.       it means that we have to get the table for us.
  150.  
  151.     - is the checkboxs are really goes one by one ? maybe they are not ?
  152.  
  153.     - does 00F35466h is the code that we need to get to ?
  154.       we have to check the jmp there .. so let patch it.
  155.  
  156.       break again in 401162
  157.  
  158. :00401162
  159.       mov eax, dword ptr [00402162]      
  160.       imul eax, 0000004D                 
  161.       cmp eax, 00F35466  ; stand here and do "r eax=00f35466"
  162.                          ; now eax will be 00f35466
  163.       jne 00401191 
  164.  
  165.       HA ! it is patched... so as the crackme rules .. no patching ! damn! ;)
  166.  
  167.       so we now know that f35466 is the result we need to get our calculation
  168.  
  169.  
  170.   ok . lets go on the code once more with our expirince we got till now ;)
  171.  
  172.  
  173. xor esi, esi                       ;we can believe now the esi will allways
  174.                                     be up by one for each checkbox.
  175. xor edx, edx                       
  176. mov dword ptr [0040215E], esi      ;this contain the ID of the last checkbox.
  177. mov dword ptr [00402162], esi      ;this will be our final result
  178.  
  179. :00401127:  -- Jmp here --
  180. movsx ecx, byte ptr [esi+004020FE] ;004020FE is 99% a table.
  181.                                    
  182.                                    
  183.                                    
  184.  
  185. cmp ecx, 0000004D                  ;what is this 4d ?? we soon look on the table
  186. je 00401162                        ;we can see now that when we get into
  187.                                    ;ID 4Dh it means that this is the last
  188.                                    ;checkbox !
  189.  
  190. mov dword ptr [0040215E], ecx      ;get the ID of the checkbox.
  191.                                    ;
  192.  
  193. push ecx                           ;ecx=ID of checkbox
  194. push [ebp+08]                    
  195. Call 00401312                      ;isDlgButtonChecked 
  196.                                                 
  197. inc esi                            ;moving to the next checkbox.
  198. cmp eax, 00000000                  ;checking if checkbox is on or off
  199.                                    
  200.  
  201. je 00401127                        ;jmp if not checked
  202.  
  203.                                    ;here he will continue if checked.
  204. mov eax, dword ptr [0040215E]      ;the last ID will be in eax.
  205.  
  206. movsx ecx, byte ptr [esi+004020FE] ;esi = next checkbox so ecx = ID of the
  207.                                    ;new Checkbox.
  208.  
  209.                                         
  210. imul eax, ecx                      ;mul the first checkbox with the second.
  211.  
  212. imul eax, esi                      ;mul the result with checkbox number.(not ID)
  213.                                                                            
  214. add dword ptr [00402162], eax      ;adding it to the total result !
  215.  
  216. jmp 00401127                       ;jmp back in the loop
  217.  
  218. //all here is after the loop end .. let see what now.
  219.  
  220. 00401162:
  221. mov eax, dword ptr [00402162]      ;he take the result of the shit we done.
  222. imul eax, 0000004D                 ;mul it with 004dh
  223.  
  224. cmp eax, 00F35466                 
  225.                                 
  226. jne 00401191                       ;then checking if it not equal to f35466
  227.                                    ;if not . BAD GUY ! if equal GOOD GUY.
  228.                                    
  229.  
  230. ----Good Guy Code ----
  231.                                    
  232. push 00002000
  233. push 00402001
  234. push 00402017
  235. push 00000000
  236. Call 004012DC
  237. mov eax, 00000001
  238. jmp 004010FA
  239.  
  240. ----- Bad guy code -----
  241. :00401191
  242.  
  243. push 00002000
  244. push 00402001
  245. push 00402068
  246.  
  247.  
  248.   so we got it ! we know what happend here but still .. what does it help us.
  249.  
  250.   let say in words what happend here :
  251.  
  252.   running on all checkboxs and mul the ID of the one of the checkboxs with
  253.   the one that after him.
  254.   after that mul the checkbox number with the result and add it to a variable
  255.   that contain the total !.
  256.  
  257.   but now ... how the hell we get the number F35466 with this kind of algo..
  258.  
  259.   ok ! :) so let first see the table of the ID's.
  260.  
  261.   I used W32Dasm to get it .. u can use what ever tool you like .
  262.  
  263.   we know that the address of the table is 004020FE so i will dump it :
  264.  
  265.                               |this is 4020FE .. see for yourself ;).
  266.                               __
  267.   :004020F8 69 74 6F 72 21 00 16 49  itor!..I
  268.   :00402100 5E 15 27 26 21 25 1D 59  ^.'&!%.Y
  269.   :00402108 53 37 31 48 5D 0C 61 52  S71H].aR
  270.   :00402110 4D 00 00 00 00 00 00 00  M.......
  271.   :00402118 00 00 00 00 00 00 00 00  ........
  272.   :00402120 00 00 00 00 00 00 00 00  ........
  273.   :00402128 00 00 00 00 00 00 00 00  ........
  274.  
  275.   ok we can see that there are 19 numbers from FE that are not zero ..
  276.   starnge because there are only 18 checkboxs.. but hey !! do you remember
  277.   that 4D ???? so here it is !! when he find 4D he finish the loop .. and
  278.   thats it absoultly 18 numbers ... 18 checkBoxs IDs !!
  279.  
  280.   ok .. but it still doesn't help us to find out the states of the checkboxs
  281.   to crack this shit .
  282.  
  283.   so before really getting into it . we allready know what calculations are
  284.   going on .. so we can write a little program that will use all the information
  285.   and run on all the combinations .
  286.  
  287.   here is what i think :
  288.     first writing a routine that will make the check (i mean check if its the
  289.     right combination) and we can do it .. just write the routine we just debugged.
  290.     second we have to write a little routine that will run on all the combinations
  291.     and call the check routine until the check routine will return "FOUND" that
  292.     can take time .. but it will work.... (7 min ;) )
  293.  
  294.   but as i said before how can we be sure that the ID's are really goes on
  295.   the table as they are in the dialog !? lets check this out !
  296.  
  297.  
  298.   run the crackme and turn ON the first checkbox ... now bpx on isdlgbuttonchecked
  299.   press the "Check" button.
  300.  
  301.   ok . now we in isdlgbuttonchecked .. press F12 and we will be out ..
  302.   let see the EAX .. is it 1 ? (ON) ... NO!! it's not !!! so they are not in
  303.   the right order !!!! fuck ! more work to be done ;)
  304.  
  305.   press more F12 (remember ESI tell us the number of the checkbox we are on)
  306.   when ESI=11h you will see that EAX=1 .. so the first one is really 11h ! (17)
  307.  
  308.   ok .. so write on paper that the 1 is really 17.
  309.  
  310.   now turn off the checkbox number 1 and turn on the checkbox number 2.
  311.   
  312.   do the same as above .. write 2 and ESI on the paper.. and do it to all of the
  313.   other checkboxs (They are only 17 left to go :) ).. when finished you will
  314.   have this table :
  315.  
  316.                            ---------------------
  317.                            | Dialog | ID Table |
  318.                            ---------------------
  319.                            |    1   |    17    |
  320.                            |    2   |     2    |
  321.                            |    3   |     3    |
  322.                            |    4   |     1    |
  323.                            |    5   |     8    |
  324.                            |    6   |     6    |
  325.                            |    7   |     7    |
  326.                            |    8   |    10    |
  327.                            |    9   |    11    |
  328.                            |   10   |     4    |
  329.                            |   11   |    12    |
  330.                            |   12   |    13    |
  331.                            |   13   |    14    |
  332.                            |   14   |    15    |
  333.                            |   15   |    16    |
  334.                            |   16   |    18    |
  335.                            |   17   |    5     |
  336.                            |   18   |    9     |
  337.  
  338.   so now we have another table .. translation table of the checkboxs.
  339.   if we found that the 17 checkbox ID is need to be ON. it means that
  340.   the first Dialog checkbox need to be ON .
  341.  
  342.   all left to be done is to write the search program and we finished.
  343.  
  344.   go and see the source code or just run the EXE it will show you what
  345.   ever i did there..
  346.  
  347.  
  348.   hope you got it ..
  349.  
  350.   thanks to Duelist's for a great crackme ! keep up the great work !
  351.  
  352.  
  353.   have a nice cracking .. and dont forget to buy the programs you are cracking!
  354.  
  355.  
  356.  
  357.   Nuno1 - Nuno_2@hotmail.com
  358.